package com.laoxu.test.springboot.api;

import com.laoxu.test.springboot.model.User;
import com.laoxu.test.springboot.service.UserService;
import com.laoxu.test.springcloud.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: 用户接口
 * @Author laoxu
 * @Date 2020/8/15 15:14
 **/
@RestController
@RequestMapping("/api/user")
public class UserApi {
    @Autowired
    UserService userService;

    @GetMapping("/{id}")
    public Result<User> getById(@PathVariable Integer id){
        return Result.ok().data(userService.getUserById(id));
    }
}
